package com.atguigu.gulimall.member.config;

import com.atguigu.gulimall.member.interceptor.LoginUserInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
 * 拦截器配置类
 */
@Configuration
public class MemberWebConfiguration implements WebMvcConfigurer {
    @Autowired LoginUserInterceptor loginUserInterceptor;

    /**
     * 添加拦截器
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {    // "/**" 表示拦截所有请求
        registry.addInterceptor(loginUserInterceptor).addPathPatterns("/**");
    }}

